package com.hnust.dao;

import com.hnust.domain.ChoiceTestQuestions;
import com.hnust.domain.Questions;
import com.hnust.domain.TestMessage;
import com.hnust.domain.TestQuestions;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author: LcWave
 * @Data: 2021/12/13
 */

@Mapper
@Repository
public interface PaperCorrectDao {
    //获取考试信息
    @Select("select test.test_name,test.beginTime,test.endTime,test.timeRange,teacher.`name`,test.createTime from" +
            "(test inner join teacher on test.createByTeacher = teacher.tea_number)inner join paper on " +
            "test.topaperid = paper.totestid where paper.pap_id = #{paperId}")
    public List<TestMessage> getTest(@Param("paperId") String paperId);

    //获取选择题
    @Select("select question.content,question.`level` from ((paper inner join question_paper on " +
            "paper.pap_id = question_paper.pap_id)inner join question on question.que_id = " +
            "question_paper.que_id)inner join question_type on question_type.que_typ_id = " +
            "question.que_typ_id where paper.pap_id = #{paperId} and question.que_typ_id = '2222'")
    public List<Questions> getChoiceQuestions(@Param("paperId") String paperId);

    //获取判断题
    @Select("select question.content,question.`level` from ((paper inner join question_paper on " +
            "paper.pap_id = question_paper.pap_id)inner join question on question.que_id = " +
            "question_paper.que_id)inner join question_type on question_type.que_typ_id = " +
            "question.que_typ_id where paper.pap_id = #{paperId} and question.que_typ_id = '1111'")
    public List<Questions> getJudgeQuestions(@Param("paperId") String paperId);

    //获取填空题
    @Select("select question.content,question.`level` from ((paper inner join question_paper on " +
            "paper.pap_id = question_paper.pap_id)inner join question on question.que_id = " +
            "question_paper.que_id)inner join question_type on question_type.que_typ_id = " +
            "question.que_typ_id where paper.pap_id = #{paperId} and question.que_typ_id = '3333'")
    public List<Questions> getGapQuestions(@Param("paperId") String paperId);

    //获取简答题
    @Select("select question.content,question.`level` from ((paper inner join question_paper on " +
            "paper.pap_id = question_paper.pap_id)inner join question on question.que_id = " +
            "question_paper.que_id)inner join question_type on question_type.que_typ_id = " +
            "question.que_typ_id where paper.pap_id = #{paperId} and question.que_typ_id = '4444'")
    public List<Questions> getEssayQuestions(@Param("paperId") String paperId);
}
